<template>
	<view>
		<view class="title">
			人员申请处理
		</view>

		<view class="input_title">
			手机
		</view>
		<input disabled class="input_class" v-model="username" type="text" placeholder="请输入个人账号"
			placeholder-style="color:#999999;">
		<view class="input_title">
			呢称
		</view>
		<view class="input_class" style="display: flex;flex-direction: row;justify-content: space-between;">
			<input disabled style="width: 400rpx;" v-model="nickname" placeholder="请输入昵称" placeholder-style="color:#999999;">
		</view>




		<view class="login_btn_off all_text_center" @click="approve('2')">
			拒绝
		</view>
		<view class="login_btn all_text_center" @click="approve('1')">
			同意
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				nickname: '',
				uid:'',


				token: '',
				member_id: '',
				value: '0'

			}
		},
		onLoad(val) {
			this.token = uni.getStorageSync('chat_token') || ''
			this.member_id = uni.getStorageSync('chat_member_id') || ''
			
			this.uid = val.member_id
			this.username = val.username
			this.nickname = val.nickname
		},
		methods: {
			
			approve(val){
				if(val == '2'){
					uni.showModal({
						title: '提示',
						content: '确定拒绝该申请吗?',
						success: function (res) {
							if (res.confirm) {
								console.log('用户点击确定');
								this.goApprove(val)
							} else if (res.cancel) {
								console.log('用户点击取消');
								return
							}
						}
					});
				}else{
					this.goApprove(val)
				}
			},

			async goApprove(val) {
				
				const res = await this.$myRequest({
					url: 'Chat/member_apply_handle',
					method: 'POST',
					data: {
						member_id: this.member_id,
						token: this.token,
						uid:this.uid,
						company_id:'1',
						status:val
					},
				});
				if (res.data.code != 200) return uni.showToast({
					title: res.data.datas.msg,
					icon: 'none'
				})
				
				uni.showToast({
					title: res.data.datas.msg,
					icon: 'none'
				})

				setTimeout(() => {
					uni.navigateBack({
						delta:1
					})
				}, 1000);
			}

		}
	}
</script>

<style lang="scss">
	page {
		display: flex;
		justify-content: center;
	}

	.argeement_line {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-top: 20rpx;

		image {
			width: 26rpx;
			height: 26rpx;
		}

		.left_box {
			width: 22rpx;
			height: 22rpx;
			border-radius: 8rpx;
			border: 1rpx solid #999999;
		}

		.rigit {
			font-size: 24rpx;
			margin-left: 20rpx;

			color: #9E9E9E;
		}
	}

	.title {
		text-align: center;
		margin-top: 100rpx;
		font-size: 50rpx;
		font-weight: 500;
		color: #333333;
	}

	.input_title {
		margin-top: 100rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}

	.input_class {
		margin-top: 20rpx;
		width: 540rpx;
		border-bottom: 1rpx solid #D8D8D8;
		padding-bottom: 10rpx;
		padding-left: 5rpx;
	}

	.mini_text {
		font-weight: 500;
		color: #008BFE;
		font-size: 26rpx;
		display: flex;
		justify-content: flex-end;
		margin-top: 20rpx;
	}

	.login_btn {
		width: 540rpx;
		height: 80rpx;
		background: #008BFE;
		color: #ffffff;
		border-radius: 12rpx;
		font-size: 36rpx;
		margin-top: 60rpx;
	}

	.login_btn_off {
		width: 540rpx;
		height: 80rpx;
		background: #f56c6c;
		color: #ffffff;
		border-radius: 12rpx;
		font-size: 36rpx;
		margin-top: 60rpx;
	}

	.mini_text_line {
		width: 540rpx;
		margin-top: 25rpx;
		font-weight: 500;
		color: #008BFE;
		font-size: 26rpx;
		display: flex;
		justify-content: space-between;
	}
</style>
